<!doctype html>
<html lang="zh-Hans">
<head>
    <meta charset="utf-8" />
    <title>$!config.title - Powered by wemall</title>
	<meta name="keywords" content="$!config.keywords" >
	<meta name="description" content="$!config.description" >
	<meta name="generator" content="yzs 1.0">
	<meta name="author" content="www.ezaisheng.com">
	<meta name="copyright" content="wemall Inc. All Rights Reserved">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    #if($!config.sina_domain_code)
	$!{config.sina_domain_code}
	#end
	#if($!config.qq_domain_code)
	$!{config.qq_domain_code}
	#end
	<link rel="stylesheet" href="$!webPath/resources/font-awesome/css/font-awesome.min.css" />
    <link rel="stylesheet" href="$!webPath/resources/style/shop/default/css/yzs.css?v=1" />
    <script src="$!webPath/resources/js/jquery-1.8.3.min.js"></script>
    <script src="$!webPath/resources/layui/layui.all.js"></script>
    <script>
         var goodclasss =[];var area=[];var color=[];var form=[];var sreachtype ="default";
	   	 #foreach($g in $!goodsclassid)
		 goodclasss.push($!g);
		 #end
		 #foreach($r in $!regionid)
		    area.push($!r);
		 #end
		 #foreach($c in $!colorid)
		   color.push($!c);
		 #end
		 #foreach($f in $!formid)
		    form.push($!f);
		 #end
		$(function(){
			$(".multiSelBtn").hover(function(){
				$(this).addClass("hover");
			},function(){
				$(this).removeClass("hover");
			});
			$(".lx-con-op span").hover(function(){
				$(this).addClass("hover");
			},function(){
				$(this).removeClass("hover");
			});
			$(".multiSelBtn").click(function(){
				$(".multiSel").removeClass("multiSel");
				var pdiv = $(this).parent().parent().parent();
				pdiv.addClass("multiSel");
				pdiv.height(pdiv.height() + 44);
				
			});
			$("#more-condition-btn").click(function(){
				if($($(".more-condition")[0]).css("display")=="none"){
					$(".more-condition").slideDown(200);
					$("#more-condition-btn").html("<i class='fa fa-angle-double-up'></i>&nbsp;收起");
				}else{
					$(".more-condition").slideUp(200);
					$("#more-condition-btn").html("<i class='fa fa-angle-double-down'></i>&nbsp;更多选项");
				}
				
			});
			$(".lx-con-op .mitbtn").click(function(){
				var selected = $(".mitbtn.selected");
				if(selected.hasClass("selected") && !$(this).hasClass("selected")){
					selected.removeClass("selected");
					selected.parent().parent().removeClass("multiSel");
					selected.parent().parent().find(".lx-btn-op").remove();
					selected.parent().parent().find(".lx-con-value p i").remove();
				}
				
				if($(this).hasClass("selected")){
					$(this).removeClass("selected");
					$(this).parent().parent().removeClass("multiSel");
					$(this).parent().parent().find(".lx-btn-op").remove();
					$(this).parent().parent().find(".lx-con-value p i").remove();
				}else{
					$(this).addClass("selected");
					$(this).parent().parent().addClass("multiSel").append('<div class="lx-btn-op"><span onclick="sreach();">确定</span><span class="cancel">取消</span><div class="lx-clear"></div></div>');
					$(this).parent().parent().find(".lx-btn-op").slideDown(200);
					$(".lx-btn-op .cancel").click(function(){
						$(this).parent().parent().find(".lx-con-op .mitbtn").click();
					});
					$(this).parent().parent().find(".lx-con-value p span").before("<i class='fa fa-square-o'></i>");
					$(this).parent().parent().find(".lx-con-value p").removeClass("selected");
				}
			});
			$(".lx-con-value").on("click","p",function(){
				if($(this).parent().parent().find(".lx-con-op .mitbtn").hasClass("selected")){
					if($(this).find(".fa").hasClass("fa-check-square-o")){
						$(this).find(".fa").removeClass("fa-check-square-o").addClass("fa-square-o");
					}else{
						$(this).find(".fa").removeClass("fa-square-o").addClass("fa-check-square-o");
					}
				}else{
					$(this).siblings(".selected").removeClass("selected");
					$(this).addClass("selected");
					sreach();
				}
			});
			
			$(".yzs-market-right-top>div").click(function(){
				if($(this).attr("id")!="btn_sure"){
					$(this).addClass("selected").siblings().removeClass("selected");
				}
				if($(this).attr("id")=="item_hubnum"||$(this).attr("id")=="item_default"){
					sreach();
				}
			});
			//更多
			$(".morebtn").click(function(){
				var index = layer.load(3, {time: 10*1000});
				var type = "more";
				if($(this).hasClass("more")){
					 $(this).removeClass("more");
					 type = "defalut";
				}else{
					$(this).addClass("more");
				}
				jQuery.post("$!webPath/more_areas.htm",{type:type},function(data){
					layer.close(index);
					jQuery(".area").empty();
					jQuery(".area").html(data);
				},"text");
			});
			$(".sreachtype input[name^='stock']").keyup(function(){
				this.value = this.value.replace(/[^\d]/g, '');
			});
			
			$(".seleced-condition").on("click","li",function(){
				$(this).remove();
				if($(this).hasClass("areas")){
					area = [];
				}if($(this).hasClass("color")){
					color =[];
				}if($(this).hasClass("goodsclass")){
					goodclasss = [];
				}if($(this).hasClass("form")){
					form = [];
				}
				sreach();
			})
		});
		//搜索方法
		function sreach(){
		     jQuery(".goodclass .selected").each(function(index,item){
		    	 if(index==0){
		    		 goodclasss = [];
		    	 }
		    	 goodclasss.push($(item).find("span").attr("data-id"));
		    	 goodclasss = unique(goodclasss);
		     });
		     jQuery(".area .selected").each(function(index,item){
		    	 if(index==0){
		    		 area = [];
		    	 }
		    	 area.push($(item).find("span").attr("data-id"));
		    	 area=unique(area);
		     });
		     jQuery(".color .selected").each(function(index,item){
		    	 if(index==0){
		    		 color = [];
		    	 }
		    	 color.push($(item).find("span").attr("data-id"));
		    	 color=unique(color);
		     });
		     jQuery(".form .selected").each(function(index,item){
		    	 if(index==0){
		    		 form = [];
		    	 }
		    	 form.push($(item).find("span").attr("data-id"));
		    	 form = unique(form);
		     });
		     jQuery(".goodclass>p").find(".fa-check-square-o").each(function(index,item){
		    	 goodclasss.push($(item).siblings("span").attr("data-id"));
		    	 goodclasss=unique(goodclasss);
		     });
		     jQuery(".area>p").find(".fa-check-square-o").each(function(index,item){
		    	 area.push($(item).siblings("span").attr("data-id"));
		    	 area=unique(area);
		     });
		     jQuery(".color>p").find(".fa-check-square-o").each(function(index,item){
		    	 color.push($(item).siblings("span").attr("data-id"));
		    	 color=unique(color);
		     });
		     jQuery(".form>p").find(".fa-check-square-o").each(function(index,item){
		    	 form.push($(item).siblings("span").attr("data-id"));
		    	 form=unique(color);
		     });
		     sreachtype = jQuery(".sreachtype .selected").attr("data-type");
			 if(sreachtype=="price"){
				 var stockMix = jQuery("input[name='stock-mix']").val();
				 var stockMax = jQuery("input[name='stock-max']").val();
				 jQuery("input[name='stock-mix']").css("border","1px solid #cccccc");
				 jQuery("input[name='stock-max']").css("border","1px solid #cccccc");
				 if(stockMix==""){
					 jQuery("input[name='stock-mix']").css("border","1px solid red");
					 return;
				 }
				 if(stockMax==""){
					 jQuery("input[name='stock-max']").css("border","1px solid red");
					 return;
				 }
			 }
			 window.location.href ="$!webPath/sreach.htm?goodclass="+goodclasss.join(",")+"&area="+area.join(",")+"&color="+color.join(",")+"&form="+form.join(",")+"&sreachtype="+sreachtype+"&mixPrice="+jQuery("input[name='stock-mix']").val()+"&maxPrice="+jQuery("input[name='stock-max']").val()+"&keyword="+jQuery("input[name='keywords']").val();
 		}
		function unique(arr) {
		    var result = [], hash = {};
		    for (var i = 0, elem; (elem = arr[i]) != null; i++) {
		        if (!hash[elem]) {
		            result.push(elem);
		            hash[elem] = true;
		        }
		    }
		    return result;
		}
    </script>
</head>
<body>
    $!httpInclude.include("/top.htm")
    $!httpInclude.include("/head.htm")
    $!httpInclude.include("/nav.htm")
	<div class="yzs-location-panner" style="background:#fff;margin-top:135px;">
		<div class="yzs-location">首页 &gt;  自营商城
			<ul class="seleced-condition">
				#if($!goodsclassid)<li class="goodsclass">品类：
				 <span>
				   #foreach($g in $!gcs)
				       #foreach($gid in $!goodsclassid)
				      	 #if($g.id == $!gid) $!g.name、 #end
				        #end
				    #end
				 </span>&nbsp;<i class="fa fa-trash"></i></li>#end
				 #if($!regionid)<li class="areas">地区：
				 <span>
				   #foreach($g in $!areas)
				       #foreach($aid in $!regionid)
				           #if($g.id == $!aid) $!g.areaName、 #end
				        #end
				    #end
				 </span>&nbsp;<i class="fa fa-trash"></i></li>#end
				 #if($!colorid)<li class="color">颜色：
				 <span>
				   #foreach($g in $!colors)
				       #foreach($cid in $!colorid)
				          #if($g.id == $!cid) $!g.name、 #end 
				        #end
				    #end
				 </span>&nbsp;<i class="fa fa-trash"></i></li>#end
				 #if($!formid)<li class="form">形态：
				 <span>
				   #foreach($g in $!forms)
				       #foreach($cid in $!formid)
				          #if($g.id == $!cid) $!g.name、 #end 
				        #end
				    #end
				 </span>&nbsp;<i class="fa fa-trash"></i></li>#end
			</ul>
		</div>
	</div>
	<div class="yzs-container-pannel">
		<div class="yzs-container">
			<hr class="lx-hr"/>
			<div calss="lx-condition">
				<div class="lx-con-row">
					<div class="lx-con-name">品类：</div>
					<div class="lx-con-value goodclass">
						#foreach($gc in $!gcs)
							<p><span data-id="$!gc.id">$!gc.name</span></p>
						#end
						<div class="lx-clear"></div>
					</div>
					<div class="lx-con-op"><span class="mitbtn">+&nbsp;多选</span></div>
					<div class="lx-clear"></div>
				</div>
				<div class="lx-con-row">
					<div class="lx-con-name">地区：</div>
					<div class="lx-con-value area">
						#set($areas=$!areaViewTools.getAreaParentIsNull(24))
						#foreach($ar in $!areas)
						   <p><span data-id="$!ar.id">$!ar.areaName</span></p>
						#end
						<div class="lx-clear"></div>
					</div>
					<div class="lx-con-op"><span class="mitbtn">+&nbsp;多选</span><span class="morebtn" mit="0">+&nbsp;更多</span></div>
					<div class="lx-clear"></div>
				</div>
				<div class="lx-con-row more-condition">
					<div class="lx-con-name">颜色：</div>
					<div class="lx-con-value color">
					   #foreach($cs in $!colors)
						<p><span data-id="$!cs.id">$!cs.name</span></p>
					   #end
						<div class="lx-clear"></div>
					</div>
					<div class="lx-con-op"><span class="mitbtn">+&nbsp;多选</span></div>
					<div class="lx-clear"></div>
				</div>
				<div class="lx-con-row more-condition">
					<div class="lx-con-name">形态：</div>
					<div class="lx-con-value form">
					  #foreach($fs in $!forms)
						<p><span data-id="$!fs.id">$fs.name</span></p>
					  #end
						<div class="lx-clear"></div>
					</div>
					<div class="lx-con-op"><span class="mitbtn">+&nbsp;多选</span></div>
					<div class="lx-clear"></div>
				</div>
			</div>
			<div id="more-condition-btn" class="yzs-market-item2-more"><i class="fa fa-angle-double-down"></i>&nbsp;更多选项</div>
			
			<div class="yzs-market-content">
				<div class="yzs-market-left">
					<div class="yzs-market-left-top">
						<div>优品推荐</div>
						<div>广告</div>
					</div>
					<div class="yzs-market-left-con">
					    #foreach($yg in $!goods_reommend_list)
					    <div class="yzs-market-left-box">
					         #set($goods_url="$!webPath/goods_$!{yg.id}.htm")
				             #if($!config.second_domain_open)
				             #set($goods_url="http://$!{yg.goods_store.store_second_domain}.$!{domainPath}/goods_$!{yg.id}.htm")
				             #end
					      	<a href="$goods_url">
						        #if($!gs.goods_main_photo)
								  #set($img="$!imageWebServer/$!{gs.goods_main_photo.path}/$!{yg.goods_main_photo.name}_small.$!{yg.goods_main_photo.ext}")
								#else
								  #set($img="$!imageWebServer/$!{config.goodsImage.path}/$!{config.goodsImage.name}")
								#end
								<div class="yzs-market-left-img"> <img src="$!img"> </div>
								<div class="yzs-market-left-title"> $!yg.name </div>
								<div class="yzs-market-left-price"> #if($!yg.memberLook)#if($!user) <span>$!yg.price</span> #else<span><a href="$!webPath/user/login.htm">登录看价</a></span>#end #else<span>$!yg.price</span> #end<span>#set($av=$!gs.area.areaName) $!CommUtil.substring("$!{av}",6)</span> </div>
							</a>
						</div>
					    #end
					</div>
				</div>
				<div class="yzs-market-right">
					<div class="yzs-market-right-top sreachtype">
						<div id="item_default" #if($!sreachtype=='default')class="selected"#end data-type="default">默认</div>
						<div id="item_hubnum" #if($!sreachtype=='stock')class="selected"#end data-type="stock">库存</div>
						<div id="item_price" #if($!sreachtype=='price')class="selected"#end data-type="price" >价格</div>
						<input type="text" name="stock-mix" placeholder="¥最低单价" value="$!mixPrice"/>
						<div style="width:20px;text-align:right;"> - </div>
						<input type="text" name="stock-max" placeholder="¥最高单价" value="$!maxPrice"/>
						<input type="text" name="keywords" placeholder="输入货品关键字" value="$!keyword"/>
						<div id="btn_sure" onclick="sreach();">确定</div>
					</div>
					<div class="yzs-market-right-con">
						<ul>
						   #foreach($gs in $!goods)
							<li>
								<div class="yzs-market-right-box">
								       #set($goods_url="$!webPath/goods_$!{gs.id}.htm")
						               #if($!config.second_domain_open)
						               #set($goods_url="http://$!{gs.goods_store.store_second_domain}.$!{domainPath}/goods_$!{gs.id}.htm")
						               #end
									<a href="$goods_url">
								        #if($!gs.goods_main_photo)
										  #set($img="$!imageWebServer/$!{gs.goods_main_photo.path}/$!{gs.goods_main_photo.name}_small.$!{gs.goods_main_photo.ext}")
										#else
										  #set($img="$!imageWebServer/$!{config.goodsImage.path}/$!{config.goodsImage.name}")
										#end
										<div class="yzs-market-left-img"> <img src="$!img"> </div>
										<div class="yzs-market-left-title"> $!gs.name </div>
										<div class="yzs-market-left-price"> #if($!gs.memberLook)#if($!user) <span>$!gs.price</span> #else<span><a href="$!webPath/user/login.htm">登录看价</a></span>#end #else<span>$!gs.price</span> #end<span>#set($av=$!gs.area.areaName) $!CommUtil.substring("$!{av}",6)</span> </div>
									</a>
								</div>
							</li>
						    #end
						</ul>
					</div>
				</div>
				<div class="blank0c"></div>
			</div>
			<div class="yzs-market-bottom">
				<div class="yzs-market-bottom-box">
					<div><img src='$!webPath/resources/style/shop/default/img/icon_07.png'>供货合作</div>
					<div class="yzs-market-bottom-box-sel"><img src='$!webPath/resources/style/shop/default/img/icon_10.png'>采购助手</div>
					<div><img src='$!webPath/resources/style/shop/default/img/icon_11.png'>行情订阅</div>
				</div>
			</div>
			
			<div class="yzs-guestlike-title">猜你喜欢<span> | 足迹 | 收藏</span>
				<div>
					<ul><li class="yzs-guestlike-title-li-sel"></li><li></li><li></li></ul>
				</div>
			</div>
			<div class="yzs-guestlike-box">
			    #foreach($cs in $!guess_goods)
					<div class="yzs-guestlike-cell">
					      #set($goods_url="$!webPath/goods_$!{cs.id}.htm")
			               #if($!config.second_domain_open)
			               #set($goods_url="http://$!{hs.goods_store.store_second_domain}.$!{domainPath}/goods_$!{cs.id}.htm")
			               #end
						 <a href="$goods_url">
					        #if($!cs.goods_main_photo)
							  #set($img="$!imageWebServer/$!{cs.goods_main_photo.path}/$!{gs.goods_main_photo.name}_small.$!{cs.goods_main_photo.ext}")
							#else
							  #set($img="$!imageWebServer/$!{config.goodsImage.path}/$!{config.goodsImage.name}")
							#end
							<div class="yzs-market-left-img"> <img src="$!img"> </div>
							<div class="yzs-market-left-title"> $!cs.name </div>
							<div class="yzs-market-left-price"> #if($!cs.memberLook)#if($!user) <span>$!cs.price</span> #else<span><a href="$!webPath/user/login.htm">登录看价</a></span>#end #else<span>$!cs.price</span> #end<span>#set($av=$!cs.area.areaName) $!CommUtil.substring("$!{av}",6)</span> </div>
						</a>
					</div>
				#end
			</div>
		</div>
		<div class="blank40"></div>	
	</div>
	$!httpInclude.include("/footer.htm") 
</body>
</html>
